export default{
  state: {
    isCollapse: false,
    menuList: [{ path: '/home', name: 'home', label: '首页', icon: 's-home' }],
    currentMenu: null
  },
  mutations: {
    isCollMenu(state){
      state.isCollapse = !state.isCollapse
    },
    selectMenu(state,val){
      if(val.name !== 'home'){
        state.currentMenu = val
        const num = state.menuList.findIndex(item => item.name === val.name)
        if(num === -1){
          state.menuList.push(val)
        }
      }else{
        state.currentMenu = null
      }
    },
    clearMenuList(state) {
      state.menuList.splice(1)
    }
  }
}
